package com.wzs.setting.service.impl;

import com.wzs.setting.dao.DicTypeMapper;
import com.wzs.setting.dao.DicValueMapper;
import com.wzs.setting.domain.DicType;
import com.wzs.setting.domain.DicValue;
import com.wzs.setting.service.DicValueService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class DicValueServiceImpl implements DicValueService {
    @Resource
    private DicTypeMapper dicTypeMapper;
    @Resource
    private DicValueMapper dicValueMapper;

    @Override
    public Map<String, List<DicValue>> getAll() {
        //System.out.println("进入impl");
        Map<String, List<DicValue>> map = new HashMap<>();
        List<DicType> dtList = dicTypeMapper.getAll();

        for (DicType d : dtList) {
            List<DicValue> dvList = dicValueMapper.getByTypeCode(d.getCode());
            map.put(d.getCode() + "List", dvList);
        }

        return map;
    }
}















